var app = getApp();

Page({
    data: {
        openId: null,
        subject_num_1: 0,
        subject_num_1: 0,
        subject_num_1: 0,
    },
    onLoad: function(optioins) {
        var self = this;

        app.getUseropenId(function(openId) {
            // console.log(openId);
            self.data.openId = openId;
            if (openId) {
                app.showLoading();
                wx.request({
                    url: app.api.findSubjectQuestionsNumber + openId + '?time=' + Date.parse(new Date()),
                    data: {},
                    header: { 'Content-Type': 'application/json' },
                    method: 'POST',
                    success: function(rs) {
                        var list = rs.data.data;
                        self.setData({
                            subject_num_1: list['1'],
                            subject_num_2: list['2'],
                            subject_num_3: list['3'],
                        });
                        app.hideLoading();
                        // console.log(self.data.checkedId)
                    }
                });
            } else {
                console.log('获取openId失败');
            }
        });
    },
})